import request from '@/utils/request'
 
// 获取设备列表
export const getDeviceList = () => {
  return request({
    url: '/device/bindList',
    method: 'POST'
  })
}
 
// 获取设备详情
export const getDeviceDetail = (id: string | number) => {
  return request({
    url: `/device/detail`,
    method: 'POST',
	data:{
		'deviceId': id
	}
  })
}

// 获取设备每周报告
export const getDeviceReport = (id: string | number) => {
  return request({
    url: '/chat/summary/getLastOne',
    method: 'POST',
	data:{
		'deviceId': id
	}
  })
}

export const deleteDevice = (id: string | number) =>{
	return request({
		url: '/device/unbind',
		method:'POST',
		data:{
			'deviceId': id
		}
	})
}
// 通过验证码绑定设备
export const bind = ((code: string | number) =>{
	return request({
		url :'/device/bindByCode',
		method: 'POST',
		data:{
			'code':code
		}
	})
})
//通过设备id绑定
export const bindByDeviceId = ((deviceId: string | number) =>{
	return request({
		url :'/device/bindByDeviceId',
		method: 'POST',
		data:{
			'deviceId':deviceId
		}
	})
})

//保存设备
export const saveBaseInfo = ((deviceId: string | number) =>{
	return request({
		url :'/device/saveBaseInfo',
		method: 'POST',
		data:{
			'deviceId':deviceId
		}
	})
})